import React, { useEffect } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { async_getwatch } from '../../store/crmsSlice'
import { Cell, Image } from 'react-vant'
import '../../App.css'
import { useNavigate } from 'react-router-dom'

export default function QuanBu() {

  //获取数据
  //获取数据
  let dispatch = useDispatch()
  useEffect(() => {
    dispatch(async_getwatch())
  }, [])
  let obj = useSelector(state => state.crms1)
  console.log(obj);

  let a = useNavigate()


  return (
    <div className='quanbubox'>

      {
        obj.watchlist.map(item => {
          return <div key={item.id}>

            <div style={{ margin: '15px 0' }} onClick={() => {
              a(`/okecheng`)
            }}> 
              <p style={{ padding: '0 20px' }}>{item.lanmu}</p>
              <Cell
                center
                key={item.id}
                value={item.title}
                icon={<Image width={100} height={80} src={item.img} />}
              />
            </div>

          </div>
        })
      }

    </div>
  )
}
